package com.test.rabbitmq.service;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SendService {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void testSend() {
        String context = "test send "+System.currentTimeMillis();
        System.out.println("sendMessage : " + context);
        rabbitTemplate.convertAndSend("test", context);//向test Queue 发送内容
    }

}